package com.smart.draw.plantuml.service;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil;
import org.springframework.stereotype.Service;

import java.io.IOException;

/**
 * @Author xiaoqiang
 * @Version TranscoderService.java, v 0.1 2025年08月26日 14:22 xiaoqiang
 * @Description: TODO
 */
@Slf4j
@Service
public class TranscoderService {

    private static final Transcoder transcoder = TranscoderUtil.getDefaultTranscoderProtected();

    @SneakyThrows(IOException.class)
    public String encode(String data) {
        return transcoder.encode(data);
    }

    @SneakyThrows(IOException.class)
    public String decode(String data) {
        return transcoder.decode(data);
    }

}